import xlrd,pymysql
from fengfan_interface.feng_test_log.feng_test_logmethod import *
class MyMethod():
    def __init__(self):
        Log()
        self.logger = logging.getLogger()

        '''excelb表格读取'''
    def duQu_Excel(self,ExcelName,Sheet, a, b):
        PathCode='../feng_excel_case\\'+ExcelName+'.xlsx'
        excel_Name = xlrd.open_workbook(PathCode)
        # 打开excel文件格式为xlsx有的是xls
        table = excel_Name.sheet_by_name(Sheet)
        cell_a1 = table.cell(a, b).value  # a代表行——从零开始   b代表列 从零开始
        self.logger.info(r'>>>获取excel表格内容：%s'%cell_a1)
        return cell_a1
    def selectSQL(self,sql):
        db=pymysql.connect(host="192.168.12.17", port=3116 ,user="mysql_yzbtest", password="jH7E6Y2zb3WX",db="yzb_app",charset ='utf8')
        cursor=db.cursor()
        #cursor.execute("select *  from  yzb_user WHERE NAME like '%s'"%('冯%'))
        cursor.execute(sql) #执行sql语句,并返回一个
        return cursor.fetchall()#取出的所有的值